<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>LifeCycle</title>
    </head>
    <body>
        <div id="app">
            <span id="title">{{msg}}</span>
        </div>
        <script src="vue.js"></script>
        <script>  
        var vm = new Vue({
            el:'#app',
            data:{
                msg:'hello'
            },
        });
        //因为修改完 data后vue不会立刻更新DOm，而是把更新放到一个队列中异步执行
        //vm.msg = 'world';
        vm.$nextTick(()=>{
            document.getElementById('title').innerText='world'
        });
        //我们要想获取更新的后的DOM，可以把回调也放入此队列中，等队列前面的代码执行完了，DOM也更新，再
        //执行回调就可以获取到最新DOM了
        vm.$nextTick(()=>{
            console.log('innerText',document.getElementById('title').innerText)
        });
       
    </script>
    </body>
</html>